<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.util.*,java.io.*,java.sql.*,java.text.*, dbAccess.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Activity Log</title>
<link rel="stylesheet" type="text/css" href="css_files/style.css" />
<style type="text/css">
<!--
.style2 {font-weight: bold}
-->
</style>

<%
String query = "select * from tbl_log";
if (request.getParameter("filter") != null) {
	if (request.getParameter("filter").equals("true")) {
		String startYear = request.getParameter("cmbStartYear").toString();
		String startMonth = request.getParameter("cmbStartMonth").toString();
		String startDay = request.getParameter("cmbStartDate").toString();
		String startDate = startYear + "-" + Login.monthFormat(startMonth) + "-" + startDay;
		String endYear = request.getParameter("cmbEndYear").toString();
		String endMonth = request.getParameter("cmbEndMonth").toString();
		String endDay = request.getParameter("cmbEndDate").toString();
		String endDate = endYear + "-" + Login.monthFormat(endMonth) + "-" + endDay;
		query = "select * from tbl_log where timeStamp >= '" + startDate + " 00:00:00' and ";
		query += "timeStamp <= '" + endDate + " 00:00:00'";
	}
}

DbAccess access = new DbAccess();
ResultSet rs;

rs = access.ExecuteSelect(access.connect(),query);
if (rs != null)
{
	while (rs.next())
	{
		String logRecord = rs.getInt("LogId") + " " + rs.getString("actionBy");
		logRecord += ": " + rs.getString("sqlString") + ", at Time: " + rs.getTime("timeStamp");
		//out.print(logRecord);
	%>
	<%=logRecord%>	
	<br>
<%
	}
}
%>
<a href="adminHome.jsp">Back to Admin Home</a>
</head>
<body>
</body>
</html>